<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->request->baseUrl . '/js/users.js');
?>
<div id="dialog-form" title="Change Password" >
<!--    <p class="validateTips">All form fields are required.</p>-->
    <p class="validateTips">Fields with <span class="requre">*</span> are required.</p>
    <form id="changepassword" name="changepassword" action="<?php echo Yii::app()->request->scriptUrl ?>/users/password?id=<?php echo $model->id ?>" method="post">
        <fieldset>
            <table width="100%" >
                <tr>
                    <td width="35%"><input type="hidden" name="restaurantAdmins_id" id="restaurantAdmins_id" value="<?php echo $model->id ?>" class="text ui-widget-content ui-corner-all" /></td>
                    <td width="1%"></td>
                    <td width="64%"></td>
                </tr>
                <tr>
                    <td ><label for="password"><strong style="font-size:11px;">Password: </strong><span class="requre">*</span></label></td>
                    <td>&nbsp;</td>
                    <td><input type="password" name="password" id="password" value="" class="text ui-widget-content ui-corner-all" /></td>
                </tr>

                <tr>
                    <td><label for="repassword"><strong style="font-size:11px;">Re-Type Password: </strong><span class="requre">*</span></label></td>
                    <td>&nbsp;</td>
                    <td><input type="password" name="repassword" id="repassword" value="" class="text ui-widget-content ui-corner-all" /></td>
                </tr>
            </table>
        </fieldset>
    </form>
</div>
<div class="form">

    <?php
    $form = $this->beginWidget('GxActiveForm', array(
        'id' => 'users-form',
        'enableAjaxValidation' => true,
            ));
    ?>

    <p class="note">
        <?php echo Yii::t('app', 'Fields with'); ?> <span class="required">*</span> <?php echo Yii::t('app', 'are required'); ?>.
    </p>

    <?php echo $form->errorSummary(array($model, $profile)); ?>
    <?php
    if ($model->isNewRecord) {
        ?>
        <div class="row">
            <div class="rowLabel"><?php echo $form->labelEx($model, 'username:<span class="required">*</span>'); ?>
            </div>
            <div class="rowControl"><?php echo $form->textField($model, 'username', array('maxlength' => 50)); ?>
                <?php echo $form->error($model, 'username'); ?>
            </div><!-- row -->
        </div>
        <?php
    } else {
        ?>
        <div class="row">
            <div class="rowLabel"><?php echo $form->labelEx($model, 'username:'); ?>
            </div>
            <div class="rowControl"><?php //echo $model->username;         ?>
                <?php echo $form->textField($model, 'username', array('maxlength' => 50)); ?>
                <?php echo $form->error($model, 'username'); ?>
            </div><!-- row -->
        </div>

        <?php
    }
    ?>


    <?php
    if ($model->isNewRecord) {
        ?>
        <div class="row">
            <div class="rowLabel"><?php echo $form->labelEx($model, 'password:<span class="required">*</span>'); ?>
            </div>
            <div class="rowControl"><?php echo $form->passwordField($model, 'password', array('maxlength' => 128, 'md5' => true)); ?>
                <?php echo $form->error($model, 'password'); ?>
            </div><!-- row -->

        </div>
        <?php
    } else {
        ?>
        <div class="row">
            <div class="rowLabel"><?php echo $form->labelEx($model, 'password:'); ?>
            </div>
            <div class="rowControl">
                <?php echo "********"; ?>
                <?php //echo $form->passwordField($model, 'password', array('maxlength' => 128, 'md5' => true)); ?>
                <?php echo $form->error($model, 'password'); ?>
                <div class="clearRow" style="padding-top: 5px;padding-bottom: 5px;">  <span id="passord_change" class="btn btn-primary"> Change</span>
                </div>
            </div><!-- row -->

        </div>

        <?php
    }
    ?>

    <div class="row">
        <div class="rowLabel"><label for="Name" class="profiletext ">First Name:<span class="required">*</span></label>
        </div>
        <div class="rowControl">  <?php echo $form->textField($profile, 'firstname', array('size' => 28, 'maxlength' => 50, 'class' => 'inputtext')); ?>
            <?php echo $form->error($profile, 'firstname'); ?>
        </div>
    </div>
    <div class="row">
        <div class="rowLabel"><label for="last_name" class="profiletext ">Last Name:<span class="required">*</span></label>
        </div>
        <div class="rowControl">  <?php echo $form->textField($profile, 'lastname', array('size' => 28, 'maxlength' => 50, 'class' => 'inputtext')); ?>
            <?php echo $form->error($profile, 'lastname'); ?>
        </div>
    </div>
    <div class="row">
        <div class="rowLabel">   <label for="Email" class="profiletext ">Email:</label>
        </div>
        <div class="rowControl">  <?php echo $form->textField($profile, 'email', array('size' => 28, 'maxlength' => 50, 'class' => 'inputtext')); ?>
            <?php echo $form->error($profile, 'email'); ?>
        </div>
    </div>
    <?php
    if (Yii::app()->user->isAdmin()) {
        ?>
        <?php
        if ($model->isNewRecord) {
            ?>
            <div class="row">
                <div class="rowLabel"><label for="last_name" class="profiletext ">Role:<span class="required">*</span></label>
                </div>
                <div class="rowControl"> 
                    <?php echo $form->dropDownList($model, 'userRole', Config::userRole(), array()); ?>

                    <?php echo $form->error($model, 'userRole'); ?>
                </div>
            </div>
            <?php
        }
        ?>
        <div class="row">
            <div class="rowLabel"><?php echo $form->labelEx($model, 'status:'); ?>
            </div>
            <div class="rowControl"><?php echo $form->checkBox($model, 'status'); ?>
                <?php echo $form->error($model, 'status'); ?>
            </div><!-- row -->
        </div>

        <?php
    }
    ?>

    <div class="row">
        <div class="rowLabel">
        </div>
        <div class="rowControl"> <?php
    echo GxHtml::submitButton(Yii::t('app', 'Save'),array('class'=>'btn btn-primary'));
    $this->endWidget();
    ?>
        </div></div>
</div>
<!-- form -->
